package ipebg.mzk.facade.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;


/**
 * 
 * @author H2601981 2015/10/10
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "MS_FUNCTION")
public class MsAdminFunction implements Serializable {
	@Id
	@GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
	@GeneratedValue(generator = "hibernate-uuid")
	@Column(name = "FUNCTIONID")
	private String functionId;
	@Column(name = "FUNCTIONNAME")
	private String functionName;
	@Column(name = "PARENTID")
	private String parentId;
	@Column(name = "FUNCTIONCODE")
	private String functionCode;
	@Column(name = "CREATEDTIME")
	private Date createdTime;
	@Column(name = "EDITTIME")
	private Date editTime;
	@Column(name = "DESCRIPTION")
	private String description;
	@Column(name = "FUNCTIONURL")
	private String functionUrl;
	
	// 多对多雙向
	//@ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},mappedBy="functionLists")
	@Transient
	public List<MsAdminRole> roleList=new ArrayList<MsAdminRole>();

	public String getFunctionId() {
		return functionId;
	}

	public void setFunctionId(String functionId) {
		this.functionId = functionId;
	}

	public String getFunctionName() {
		return functionName;
	}

	public void setFunctionName(String functionName) {
		this.functionName = functionName;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getFunctionCode() {
		return functionCode;
	}

	public void setFunctionCode(String functionCode) {
		this.functionCode = functionCode;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Date getEditTime() {
		return editTime;
	}

	public void setEditTime(Date editTime) {
		this.editTime = editTime;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<MsAdminRole> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<MsAdminRole> roleList) {
		this.roleList = roleList;
	}

	public String getFunctionUrl() {
		return functionUrl;
	}

	public void setFunctionUrl(String functionUrl) {
		this.functionUrl = functionUrl;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof MsAdminFunction) {   
			MsAdminFunction function = (MsAdminFunction) obj;   
            return this.functionId.equals(function.functionId);   
        }   
        return super.equals(obj);  
	}
}
